/**
 * Created by hama on 2016/6/11.
 */

$('form').submit(function(ev){
    ev.preventDefault()

    var formData = $(this).serializeArray();
    $.post('/answer', formData, function(res){
        $('.modal-body').text(res.message)
        $('.modal').modal('show')
            .on('hidden.bs.modal', function (e) {
                if(res.code == 'success'){
                    location.href = '/'
                }
            })
    }, 'json')
})